$(function(){
	var depCode = '';
	var depName = '';
	//页面加上查询条件
	showCondition(true);
	
		
   // 获取当前登录的科室和科室名
	$.ajax({
		url : "DepCliMonitor/getRoleName.dhc",
		async : false,
		type : "POST",
		success : function(result) {
			depCode = result.depCode;
			depName = result.depName;
			if(depCode==null||depCode=="")
			{//如果角色还未授权科室 无法查看数据
				$('#'+tabId+' #warninginfo').css('display','block');
				$('#'+tabId+' .container').css('display','none');
				return;
			}
			$("#" + tabId + " #depCode").val(depCode);
			$("#" + tabId + " #depName").val(depName);
			paramTabPage[tabId].deps = depCode;	
			paramTabPage[tabId].depName = depName;
			var monitorType = '';
			if(depCode.split(",").length>1)
			{//多个科室
				monitorType = 'depGroup';
			}
			else
			{//一个科室
				monitorType = 'dep';
			}
			getQuotas("departmentDisMonitor_1", loadData_1, "departmenthosp-ul");
			function loadData_1(totalQuota,type){
				/*
				 * 全院指标 (1.Hosp 2.All) 参数：1.查询类型2.查询全部
				 * 数据3.查询的指标以及页签名4.此部分所加载的div的id，3.div下面的ul
				 */
				loadDepartmentAllQuota("ALL", totalQuota,"departmentHospQuotasId", "departmenthosp-ul");
				/*
				 * 加载下面的的div 参数：1.查询指标2.表格头部显示的名字3.布局所在的页面4。div下面的ul
				 */
				loadDepartmentQuota(totalQuota, "MDC","departmentDepQuotasId", "departmentdep-ul");
				// 为下半部分加载数据
				loadDepartmentQuotaData(totalQuota, "mdc", false);
			}
		}
	});
});


function loadMdcToAdrg(code,desc){
	var param = jQuery.extend(true,{},paramTabPage[tabId]);
	param.mdcCode = code;
	openTab('/pages/department/departmentDisAdrgMonitor.jsp',code+'|ADRG','mdctoadrg'+code,'mdctoadrg'+code,param);

}
function loadMdcToDep(code,desc){
	var param = jQuery.extend(true,{},paramTabPage[tabId]);
	param.mdcCode = code;
	openTab('/pages/department/departmentDisDepMonitor.jsp',code+"|科室",'mdctodep'+code,'mdctodep'+code,param);
}